package cn.edu.neusoft.zengweidong707.login;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Activity_Reg extends AppCompatActivity {
    private EditText reg_name;
    private EditText reg_password;
    private EditText address;
    private Button reg;
    private Button btn2;
    private static String TAG = "Activity_2";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "onCreate: ");
        setContentView(R.layout.activity_reg);

        reg_name = (EditText)findViewById(R.id.reg_name);
        reg_password = (EditText)findViewById(R.id.reg_password);
        address = (EditText)findViewById(R.id.addrss);
        reg = (Button)findViewById(R.id.reg);
        btn2 = (Button)findViewById(R.id.btn2);

        Intent intent = getIntent();

        String remessage = intent.getStringExtra("message");
        address.setText(remessage);

        reg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = reg_name.getText().toString();
                Intent intent1 = new Intent(Activity_Reg.this, MainActivity.class);
                startActivity(intent1);
                intent1.putExtra("return", name);
                setResult(RESULT_OK, intent1);
                finish();
            }
        });

        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent2 = new Intent(Activity_Reg.this, Main3Activity.class);
                startActivity(intent2);
                //finish();
            }
        });
    }
    @Override
    protected void onStart() {
        super.onStart();
        Log.i(TAG, "onStart: ");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i(TAG, "onStop: ");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i(TAG, "onRestart: ");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "onDestroy: ");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i(TAG, "onResume: ");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i(TAG, "onPause: ");
    }
}
